﻿//////////////////////////////////////////////////////////////////////////////////////////////////////
//Name: Bartosz
//FullName: Adamczewski
//Project: InternalClasses
//Component: InternalClasses
//StartDate: 2009-08-17 19:29:04
//EndDate: 2009-08-17 19:29:04
//Description: The implementation of InternalClasses component.
//Rights:  Copyright (c) Bartosz Adamczewski
/////////////////////////////////////////////////////////////////////////////////////////////////////

#region imports.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection.Emit;
using System.Reflection;
using InternalClasses.Dynamic;

#endregion

namespace InternalClasses.Context.Actions
{
    public class ConsoleWriteAction : MethodInjectionAction
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ConsoleWriteAction"/> class.
        /// </summary>
        public ConsoleWriteAction() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ConsoleWriteAction"/> class.
        /// </summary>
        /// <param name="input">The input.</param>
        public ConsoleWriteAction(string input) 
        {
            base.Method = typeof(ConsoleWriteAction).GetMethod("Write");
            base.InjectionType = InternalClasses.Dynamic.InjectionType.BeforeSource;
            base.Parameters = new object[] { input };
        }

        /// <summary>
        /// Writes the specified method data.
        /// </summary>
        /// <param name="methodData">The method data.</param>
        /// <param name="metaData">The meta data.</param>
        public void Write(object[] methodData, object[] metaData)
        {
            Console.WriteLine(metaData[0]);
        }
    }
}
